[typespec-python] Add generated test regeneration workflow#46414
Open
iscai-msft wants to merge 23 commits intoAzure:mainfrom
Open
[typespec-python] Add generated test regeneration workflow#46414iscai-msft wants to merge 23 commits intoAzure:mainfrom
iscai-msft wants to merge 23 commits intoAzure:mainfrom
Conversation
Add typespec-python-regen.yml workflow that regenerates Python SDK test code from microsoft/typespec's http-client-python emitter. Outputs both azure and unbranded flavors to eng/tools/typespec-python-generated-tests/. Triggers: - repository_dispatch (from microsoft/typespec on merge) - workflow_dispatch (manual, with configurable ref) Creates an auto-merge PR when regenerated code changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds automation to keep a canonical, regenerated copy of TypeSpec Python emitter-generated test code in this repo, by introducing a GitHub Actions workflow plus documentation for the generated-test directory.
Changes:
- Introduces a new GitHub Actions workflow to regenerate and PR generated tests from
microsoft/typespec’shttp-client-pythonemitter. - Adds documentation describing the purpose, layout, and regeneration path for
eng/tools/typespec-python-generated-tests/.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
eng/tools/typespec-python-generated-tests/README.md |
Documents what the generated tests are and how regeneration is expected to work. |
.github/workflows/typespec-python-regen.yml |
Implements the automated regeneration + PR creation (and auto-merge) workflow. |
Regenerated from microsoft/typespec@fae1a8f (main) - 116 azure flavor packages - 65 unbranded flavor packages Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add dispatch sender validation guard - Use fetch-depth: 0 for reliable PR branch creation - Inline ref expression in checkout to avoid GITHUB_OUTPUT injection - Sanitize ref value before writing to GITHUB_OUTPUT for PR metadata - Make auto-merge conditional on workflow_dispatch only (not repository_dispatch) - Update README with full regeneration steps (install, build, prepare) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4d93412 to
66d6d35
Compare
- Rename folder: typespec-python-generated-tests -> tsp-python-gen (fixes path length >260 chars) - Rename workflow: typespec-python-regen.yml -> typespec-python-regenerate.yml (fixes cspell 'regen' errors) - Replace 'Regen' with 'Regenerate' in workflow name and dispatch type - Add CODEOWNERS for tsp-python-gen/ and the workflow file Owners: @tadelesh @msyyc @iscai-msft @lmazuel @lirenhe Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bbd4ecd to
6c16f54
Compare
scbedd
reviewed
Apr 21, 2026
Use native gh CLI for PR creation instead of third-party action. Commits only eng/tools/tsp-python-gen/ changes, force-pushes to a fixed branch, and creates or updates an existing PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Re-add auto-merge via gh pr merge --auto --squash - Add notify-on-failure job that creates a GitHub issue assigned to @iscai-msft when the workflow fails (triggers email notification) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace repository_dispatch with daily schedule (8:00 UTC) - Add check-version job that compares npm version to .last-version marker - Only regenerate when a new version is detected or manually triggered - Update .last-version marker after each regeneration - Remove dispatch sender validation (no longer applicable) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- repository_dispatch: fired by typespec publish pipeline after npm release - schedule: daily 8:00 UTC fallback to catch any missed dispatches - workflow_dispatch: manual trigger with configurable ref - Checkout uses dispatch sha when available Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lmazuel
approved these changes
Apr 21, 2026
scbedd
reviewed
Apr 22, 2026
scbedd
reviewed
Apr 22, 2026
scbedd
approved these changes
Apr 22, 2026
Member
scbedd
left a comment
There was a problem hiding this comment.
Approving the github workflow. Manually triggered. Doesn't use 3P actions. Pins 1P actions to versions.
Nit: please run this script against your action before merging -- just to double check.
Run this with -Path .github/workflows/typespec-python-regenerate.yml and make certain nothing changes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…anded/unbranded - Replace repository_dispatch + daily schedule with push trigger on eng/emitter-package.json - Add manual workflow_dispatch with emitter choice (branded/unbranded) and version input - Install target emitter from npm instead of always using built-in - Remove check-version job and .last-version marker file - Pass --emitterName to regeneration script for emitter selection Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Move from eng/tools/tsp-python-gen/ to eng/tools/azure-sdk-tools/emitter/generated/ - Add README.md at eng/tools/azure-sdk-tools/emitter/ describing the directory - Update workflow and CODEOWNERS references Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- emitter-package-update skill: add background section, tsp-client generate-config-files step, and automatic regeneration after merge - static_type_checking.md: point to microsoft/typespec for TypeSpec-based SDK generator issues Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The generated test files under emitter/ were being included in the azure-sdk-tools pip install, ending up in venv/lib/site-packages/ and triggering path length violations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The previous location eng/tools/azure-sdk-tools/emitter/generated/ had two issues: 1. Files were included in azure-sdk-tools pip install (into venv site-packages) 2. Path prefix was too long (44 chars), causing 22 files to exceed the 260-char Windows path limit New location eng/emitter/gen/ (16 chars) saves 28 chars, eliminating all path length violations. Also reverts the pyproject.toml workaround since files are no longer under azure-sdk-tools. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lmazuel
approved these changes
Apr 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
l0lawrence
approved these changes
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a GitHub Actions workflow that regenerates Python SDK test code from
microsoft/typespec'shttp-client-pythonemitter and stores the output ineng/tools/typespec-python-generated-tests/.Motivation
The TypeSpec Python emitter (
@typespec/http-client-python) generates test code againsthttp-specsandazure-http-specstest suites. Currently these generated tests aren't tracked anywhere persistent. This workflow keeps a canonical copy in azure-sdk-for-python, updated automatically when the emitter changes.How it works
Triggers
repository_dispatch— automated, triggered from microsoft/typespec when http-client-python merges to mainworkflow_dispatch— manual, with configurabletypespec_ref(branch, tag, SHA, ormainfor latest unreleased code)Steps
npm run regenerateto generate both azure and unbranded flavorseng/tools/typespec-python-generated-tests/{azure,unbranded}/Output structure